from django.db import models

# Create your models here.
from mlh.utils.models import BaseModel


from users.models import User
from questions.models import Question


class Answers(BaseModel):
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name="回答人", related_name="answer", null=True)
    answer_title=models.CharField(verbose_name="回答的问题",max_length=32)
    content = models.TextField(verbose_name="回答内容", null=True)
    use_number = models.IntegerField(verbose_name="有用的数量", null=True)
    question = models.ForeignKey(Question, on_delete=models.CASCADE, verbose_name="对应问题", related_name="questions",null=True)

    class Meta:
        db_table = 'tb_answer'
        verbose_name = '回答表'
        verbose_name_plural = verbose_name
